package vista;

import java.awt.Polygon;
import java.awt.Rectangle;
import java.util.Observable;
import java.util.Observer;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;

import juego.Juego;

import mapas.Region;

import control.mapa.ControladorMouseRegion;

public class VistaRegion extends JLabel implements Observer{
	
	private int id;
	private Polygon p;
	
	public VistaRegion(int id, Rectangle medidas, Polygon p){
		this.id = id;
		this.setBounds(medidas);
		this.setVisible(true);
		this.setOpaque(false);
		this.setHorizontalAlignment(JLabel.CENTER);
		this.p = p;
	}
	public int getId(){
		return this.id;
	}
	public void update(Observable o, Object arg) {
		
		Region reg = (Region)o;
		if(reg.estaConquistada() == true){
			Juego jueg = Juego.getInstance();
			this.setIcon(new imagenBanderita(jueg.getRonda().getTurnoDe(reg.getCivilizacion())));
		}
		else
			this.setIcon(null);
	}
	public Polygon getPolygon() {
		return this.p;
	
	}
	
	
}
